<?php
namespace app\jincheng\controller;
use think\Db;
use think\Controller;
use think\Log;
use app\service\jinchengService;

class Test extends Controller{
	public function paytest(){
		$api=new jinchengService();
		$user_id="2088112618452297";//  
		$form_id="MjA4ODExMjYxODQ1MjI5N18xNTkwOTc4OTU0MjE3Xzc1Ng=="; 	  

		$template_id="MzdkM2FkNmIzODk0OGYzNWRlMGU2OTg3MjM5ZWFhMTk=";
		$page="pages/index/index";
		$pay_type="物业费";
		$paymoney="300元";
		$remark="请尽快缴费";
		$url="http://www.baidu.com";
		$owner_name="张三";
		$title="测试";
		$remark="1234";
		$acct_period="123456";
		$res=$api->payMsg(json_encode(['user_id'=> $user_id,'owner_name'=>$owner_name,'pay_type'=>$pay_type,'pay_money' =>$paymoney,'url'=>$url,'title'=>$title,"remark"=>$remark,"acct_period"=>$acct_period ]));
		var_dump($res);
	}
	public function yzl2(){
		$msg["title"]="尊敬的会员，你有一笔新的积分入账啦";
		$msg["user_id"]="2088112618452297";//"2088102690661313";
		$msg["url"]="";
		$msg["shop_name"]="早早小店";
		$msg["pay_money"]="10"."元";
		$msg["give_point"]="10"."积分";
		$msg["point"]="100"."积分";
		$msg["time"]=date('Y-m-d H:i:s');
		
		$msg["remark"]="";
		$api=new jinchengService();
        $result = $api->getPointMsg(json_encode($msg));
		var_dump($result);
	}
	public function yzl(){
		$user_id="2088112618452297";
		$form_id="MjA4ODExMjYxODQ1MjI5N18xNTkwOTc4OTU0MjE3Xzc1Ng=="; 	  

		$template_id="MzdkM2FkNmIzODk0OGYzNWRlMGU2OTg3MjM5ZWFhMTk=";
		$page="pages/index/index";
		$pay_type="物业费";
		$paymoney="300元";
		$remark="请尽快缴费";
		$url="http://www.baidu.com";
		$owner_name="张三";
		$title="测试";
		$remark="";
		$acct_period="123456";
		$str="{" .
            "\"to_user_id\":\"$user_id\"," .
            "\"template\":{" .
                "\"template_id\":\"952c8c29d4824c45b5d4b85f63b90b02\"," .
                "\"context\":{" .
                    "\"head_color\":\"#85be53\"," .
                    "\"url\":\"$url\"," .
                    "\"action_name\":\"查看详情\"," .
                    "\"keyword1\":{" .
                            "\"color\":\"#85be53\"," .
                            "\"value\":\"$owner_name\"" .
                        "        }," .
                        "\"keyword2\":{" .
                            "\"color\":\"#85be53\"," .
                            "\"value\":\"$pay_type\"" .
                        "        }," .
                        "\"keyword3\":{" .
                            "\"color\":\"#85be53\"," .
                            "\"value\":\"$paymoney\"" .
                        "        }," .
                        "\"keyword4\":{" .
                            "\"color\":\"#85be53\"," .
                            "\"value\":\"$acct_period\"" .
                        "        }," .
                        "\"first\":{" .
                            "\"color\":\"#85be53\"," .
                            "\"value\":\"$title\"" .
                        "        }," .
                        "\"remark\":{" .
                            "\"color\":\"#85be53\"," .
                            "\"value\":\"$remark\"" .
                        "        }" .
                    "      }" .
                "    }" .
            "  }";
        return $str;
	}
	public function index(){
		$api=new jinchengService();
		$user_id="2088112618452297";
		$form_id="MjA4ODExMjYxODQ1MjI5N18xNTkwOTc4OTU0MjE3Xzc1Ng=="; 	  

		$template_id="MzdkM2FkNmIzODk0OGYzNWRlMGU2OTg3MjM5ZWFhMTk=";
		$page="pages/index/index";
		$cost_type="物业费";
		$paymnoney="300元";
		$remark="请尽快缴费";
		$data="{\\\"keyword1\\\":{\\\"value\\\":\\\"$cost_type\\\"},\\\"keyword2\\\":{\\\"value\\\":\\\"$paymnoney\\\"},\\\"keyword3\\\":{\\\"value\\\":\\\"$remark\\\"}}";
		$res=$api->appletSendMsg(json_encode(['user_id'=> $user_id,'form_id'=>$form_id,'template_id'=>$template_id,'page' =>$page,'data'=>$data ]));
		var_dump($res);
	}
	public function invoice(){
		$api=new jinchengService();
		$user_id="2088112618452297";
		$form_id="YTQyMWZhYmY4Mzc4NTFmZTAyYWYzMjk2YTBlOThiMzc="; 	  

		$template_id="MzdkM2FkNmIzODk0OGYzNWRlMGU2OTg3MjM5ZWFhMTk=";
		$page="pages/index/index";
		$company="金城物业公司";
		$paymnoney="300元";
		$remark="您的发票申请已通过，将于7个工作日内发至您的预留邮箱，请注意查收";
		$data="{\\\"keyword1\\\":{\\\"value\\\":\\\"$company\\\"},\\\"keyword2\\\":{\\\"value\\\":\\\"$paymnoney\\\"},\\\"keyword3\\\":{\\\"value\\\":\\\"$remark\\\"}}";
		$res=$api->appletSendMsg(json_encode(['user_id'=> $user_id,'form_id'=>$form_id,'template_id'=>$template_id,'page' =>$page,'data'=>$data ]));
		var_dump($res);
	}

	public function paymsg(){
		$api=new jinchengService();
		$user_id="2088112618452297";
		$form_id="MjA4ODExMjYxODQ1MjI5N18xNTkwOTc4OTU0MjE3Xzc1Ng=="; 	  

		$template_id="ZDE0OWQ2MGU3MjVjYmMzOTYwMWUyNDZmMWY5MzljZTY=";
		$page="pages/index/index";
		$company="金城物业公司";
		$paytype="物业费";
		$paymnoney="300元";
		$paystatus="支付成功";
		$remark="备注信息";
		$data="{\\\"keyword1\\\":{\\\"value\\\":\\\"$company\\\"},\\\"keyword2\\\":{\\\"value\\\":\\\"$paytype\\\"},\\\"keyword3\\\":{\\\"value\\\":\\\"$paymnoney\\\"},\\\"keyword4\\\":{\\\"value\\\":\\\"$paystatus\\\"},\\\"keyword5\\\":{\\\"value\\\":\\\"$remark\\\"}}";
		$res=$api->appletSendMsg(json_encode(['user_id'=> $user_id,'form_id'=>$form_id,'template_id'=>$template_id,'page' =>$page,'data'=>$data ]));
		var_dump($res);
	}
	
}